package com.engine4cloud.tdf.supervision.feign;

import com.engine4cloud.tdf.common.core.constant.SecurityConstants;
import com.engine4cloud.tdf.common.core.constant.ServiceNameConstants;
import com.engine4cloud.tdf.common.core.util.R;
import com.engine4cloud.tdf.common.data.web.response.PageInfo;
import com.engine4cloud.tdf.common.data.web.response.Params;
import com.engine4cloud.tdf.supervision.dto.create.JzdxLegalInstrumentCreateDTO;
import com.engine4cloud.tdf.supervision.dto.query.JzdxLegalInstrumentQueryDTO;
import com.engine4cloud.tdf.supervision.dto.result.JzdxLegalInstrumentResultDTO;
import com.engine4cloud.tdf.supervision.dto.update.JzdxLegalInstrumentUpdateDTO;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


/**
 * 宣告书-法律文书
 *
 * @author sh
 * @date 2024-08-02 15:07:07
 */
@FeignClient(contextId = "RemoteJzdxLegalInstrumentWebService", value = ServiceNameConstants.SUPERVISION_SERVER)
public interface RemoteJzdxLegalInstrumentWebService {

    /**
     * 分页查询
     *
     * @param page 分页对象
     * @param dto  法律文书
     * @return R<PageInfo < JzdxLegalInstrumentResultDTO>>
     */
    @GetMapping("/web/legal/instrument/page")
    R<PageInfo<JzdxLegalInstrumentResultDTO>> getLegalInstrumentPage(@RequestParam("page") Params page,
                                                                     @Valid @RequestParam("dto") JzdxLegalInstrumentQueryDTO dto,
                                                                     @RequestHeader(SecurityConstants.FROM) String from);


    /**
     * 通过id查询法律文书
     *
     * @param id id
     * @return R
     */
    @GetMapping("/web/legal/instrument/{id}")
    R<JzdxLegalInstrumentResultDTO> getById(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 新增法律文书
     *
     * @param dto 法律文书
     * @return R
     */
    @PostMapping("/web/legal/instrument")
    R<Boolean> create(@Valid @RequestBody JzdxLegalInstrumentCreateDTO dto, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 修改法律文书
     *
     * @param dto 法律文书
     * @return R
     */
    @PutMapping("/web/legal/instrument")
    R<Boolean> update(@Valid @RequestBody JzdxLegalInstrumentUpdateDTO dto, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 通过id删除法律文书
     *
     * @param ids id列表
     * @return R
     */
    @DeleteMapping("/web/legal/instrument")
    R<Boolean> removeById(@RequestBody Long[] ids, @RequestHeader(SecurityConstants.FROM) String from);
}
